import Vue from 'vue'
import VueI18n from 'vue-i18n'

import elementUIUs from 'element-ui/lib/locale/lang/en'
import elementUIDe from 'element-ui/lib/locale/lang/de'
import elementUIEs from 'element-ui/lib/locale/lang/es'
import elementUIFr from 'element-ui/lib/locale/lang/fr'
import elementUIIt from 'element-ui/lib/locale/lang/it'
import elementUIJp from 'element-ui/lib/locale/lang/ja'

import us from './us'
import de from './de'
import es from './es'
import fr from './fr'
import it from './it'
import jp from './jp'

Vue.use(VueI18n)

const messages = {
  us: {
    ...elementUIUs,
    ...us
  },
  de: {
    ...elementUIDe,
    ...de
  },
  es: {
    ...elementUIEs,
    ...es
  },
  fr: {
    ...elementUIFr,
    ...fr
  },
  it: {
    ...elementUIIt,
    ...it
  },
  jp: {
    ...elementUIJp,
    ...jp
  }
}
let site = JSON.parse(localStorage.getItem('site'))
// console.log(site,'8888')
const i18n = new VueI18n({
  locale: site && site.siteLang || 'us', // set locale
  messages // set locale messages
})
export default i18n